package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.GuardrailFaultCountService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by syk on 2017/11/21.
 */
@Controller
@RequestMapping("/rds_guardrail_fault_count")
public class GuardrailFaultCountController {
    @Resource
    private GuardrailFaultCountService guardrailFaultCountService;

    @RequestMapping(value = "/getDealReportExpensesCount")
    @ResponseBody
    public JsonMsgDto getDealReportExpensesCount(Integer year, Integer orgId, Integer userId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(guardrailFaultCountService.getDealReportExpensesCount(year, orgId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getFault4DT")
    @ResponseBody
    public DTResponseDto getFault4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = guardrailFaultCountService.getFault4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/getDevice4DT")
    @ResponseBody
    public DTResponseDto getDevice4DT(Integer userId, Integer orgId, DTRequestDto dtRequestDto) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = guardrailFaultCountService.getDevice4DT(userId, orgId, dtRequestDto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }
}
